//var username = prompt("Enter your username: ");
getTwitterByUsername('thanhit08');
function getTwitterByUsername(username){
	$.ajax({
		type:'GET',
        dataType:'jsonp',
        data:{screen_name:'thanhit08', include_rts:1}, //show retweets
        url:'http://api.twitter.com/1/statuses/user_timeline.json',
        success:function(data, textStatus, XMLHttpRequest) {
			var tmp = false;
            var results = $('#twitter_results');
            //console.log(data);
            for(i in data) {
                if(data[i].retweeted_status != null) {
                    tmp = $('<li class="retweet" itemid="'+data[i].retweeted_status.id_str+'"><div class="dogear"></div><img src="'+data[i].retweeted_status.user.profile_image_url+'" alt="" align="left" width="48" height="48" /><cite>'+data[i].retweeted_status.user.screen_name+'</cite><p>'+data[i].retweeted_status.text+'</p></li>');
                    if(data[i].retweeted_status.favorited) {
                        tmp.addClass('favorite');
                    }
                } else {
                    tmp = $('<li itemid="'+data[i].id_str+'"><div class="dogear"></div><img src="'+data[i].user.profile_image_url+'" alt="" align="left" width="48" height="48" /><cite>'+data[i].user.screen_name+'</cite><p>'+data[i].text+'</p></li>');
                    if(data[i].favorited) {
                        tmp.addClass('favorite');
                    }
                }
                
                results.append(tmp);
            }
		},
		error: function(req, status, error){
			alert('error: '+status);
		}
	});
}